package com.sp.business.normalization.impl;

import java.util.UUID;

import org.apache.commons.lang.StringUtils;

import com.sp.generated.xml.firemon.InboundAppliedContext;
import com.sp.generated.xml.firemon.NATRule;
import com.sp.generated.xml.firemon.NATRuleCollection;
import com.sp.generated.xml.firemon.OutboundAppliedContext;

public abstract class NatRuleKeyGenerator
{
  public abstract void generateNATRuleKeys(NATRuleCollection previous, NATRuleCollection current);

  public static String copyUID(NATRule previous, NATRule current)
  {
    String guid = null;

    if (previous != null)
      guid = previous.getUID();

    if (StringUtils.isBlank(guid) || !NormalizationUtil.isStringUUID(guid))
      guid = String.format("{%s}", UUID.randomUUID().toString().toUpperCase());

    current.setUID(guid);

    current.setXsid("NATRule" + guid.replaceAll("\\{", "").replaceAll("\\}", ""));

    return guid;
  }
  
  public static boolean isSameFrom(final InboundAppliedContext previousFrom, final InboundAppliedContext newFrom)
  {
    //FIXME
    return true;
  }
  
  public static boolean isSameTo(final OutboundAppliedContext previousTo, final OutboundAppliedContext newTo) 
  {
    //FIXME 
    return true;
  }
  
}
